Repository navigation
feat(generate): multi-level mesh undo with a bounded per-model stack - #404
Merged
Merged
Conversation
Mesh edits never overwrite their input (every op writes a new workspace file), so undo only needs the chain of URLs. Move it into a pure meshHistory module and route every edit through one store action: - applyMeshEdit(url) records the edit from the mesh currently shown, seeding it as the baseline when it was never recorded (workflow outputs, Add to Scene), so the first edit is always undoable. - The stack is capped at 20 undo steps; a new edit drops the redo branch. - setCurrentJob resets the stack, so undo never jumps to another model (import, library open, Add to Scene and workflow runs used to keep it). - Smooth, decimate and agent mesh tools all go through applyMeshEdit. - The undo button shows the number of available steps. Closes #304
lightningpixel
force-pushed
the
feat/304-multi-level-undo
branch
from
November 11, 2026 10:22
796e74c to
6d3f28d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #304
Finding
Edits never overwrite their input: every op (
/optimize/op/{id},/arrange,/transform, decimate, smooth) writes a new GLB next to it, and nothing deletes them. A stack of URLs is therefore enough to restore earlier meshes, with no snapshot copies and no extra disk use.The store already had a URL history with redo. What was broken:
setCurrentJobnever reset it. After an import, a library open, Add to Scene or a workflow run, undo jumped back to the previous model.outputUrlbefore pushing, so a mesh that reached the viewer unrecorded (workflow output, Add to Scene) couldn't be undone back to.Changes
meshHistory.ts: a stack capped at 20 undo steps, with record / record-edit / step back / step forward and undo/redo depth.applyMeshEdit(url): it records the edit from the mesh on screen, seeding that mesh first if it isn't current. Smooth, decimate and agentmesh_updateresults all go through it.pushMeshUrlnow only records a freshly loaded mesh.setCurrentJobresets the stack to the new job's mesh, even for the same id, since Add to Scene reusesworkflow-output.Merge note
Conflicts with #403 on the
test:nodeline ofpackage.jsononly (both add a test file). Whichever merges second needs a one-line rebase; I'll handle it.Not done
Test plan
meshHistory.test.ts(new): 12/12, including "3 edits then 3 undos restore the initial mesh"npm test, full suite) passed